﻿@{
    Layout = null;
    var SearchParma = TempData["SearchParma"] as HanGu.Entity.UniversallySearchParam;
    SearchParma = SearchParma ?? ViewData["SearchParma"] as HanGu.Entity.UniversallySearchParam;
    TempData["SearchParma"] = SearchParma;
    var SexList = ViewData["SexList"] as SelectList;
    var IsMarryList = ViewData["IsMarry"] as SelectList;
    var ProviceList = ViewData["Provice"] as SelectList;
    var CityList = ViewData["City"] as SelectList;
    var NativePlaceList = ViewData["NativePlace"] as SelectList;
    var JobList = ViewData["Job"] as SelectList;
    var TradeList = ViewData["Trade"] as SelectList;
    var InterestList = ViewData["Interest"] as SelectList;

    var MemberGrade = ViewData["MemberGrade"] as SelectList;
    var Degree = ViewData["Degree"] as SelectList;
    var Oganization = ViewData["Oganization"] as SelectList;
    var Groups = ViewData["Groups"] as SelectList;
    var GroupsSelected = new List<string>();
    if (!string.IsNullOrEmpty(SearchParma.Groups))
    {
        GroupsSelected = SearchParma.Groups.Split(',').ToList();
    }
    var Parents = ViewData["Parents"] as SelectList;
    var ImportantLevels = ViewData["ImportantLevel"] as SelectList;
    var AssignedInsSelected = new List<string>();
    if (SearchParma.SubAssignedIn != null)
    {
        AssignedInsSelected = SearchParma.SubAssignedIn.Select(c => c.ToString()).ToList();
    }

    var JobSelected = new List<string>();
    if (SearchParma.Job != null)
    {
        JobSelected.AddRange(SearchParma.Job.Split(','));
    }

    var TradeSelected = new List<string>();
    if (SearchParma.Trade != null)
    {
        TradeSelected.AddRange(SearchParma.Trade.Split(','));
    }
    var Position = ViewData["Position"] as SelectList;
    var PositionSelected = new List<string>();
    if (SearchParma.Position != null)
    {
        PositionSelected.AddRange(SearchParma.Position.Split(','));
    }

    List<string> InterestArry = new List<string>();
    if (SearchParma.Interest != null)
    { InterestArry.AddRange(SearchParma.Interest.Split(',')); }

    var action = Request["action"];
    action = action ?? "search";
    int layouth = action == "search" ? 58 : 350;
    string callbackSearch = "navTabSearch(this)";
    if (action == "SelectorForGroup")
    {
        callbackSearch = "divSearch(this,'GroupMembers')";
    }
    bool isShowPage = action == "search";
}
<div class="pageContent" id="SearchFormDIV">
    <script>
        $(function () {
            $("#HighSearchForm #Degree").val("@SearchParma.Degree");
            $("#HighSearchForm #Grade").val("@SearchParma.Lectcher");
            $("#HighSearchForm #Sex").val("@SearchParma.Sex");
            $("#HighSearchForm #IsMarry").val("@SearchParma.IsMarry");
            $("#HighSearchForm #Provice").val("@SearchParma.Provice");
            $("#HighSearchForm #City").val("@SearchParma.City");
            $("#HighSearchForm #NativePlace").val("@SearchParma.NativePlace");
            $("#HighSearchForm #GroupID").val("@SearchParma.Groups");
            $("#HighSearchForm #Oganization").val("@SearchParma.Oganization");
            $("#HighSearchForm #ImportantLevel").val("@SearchParma.ImportantLevel");
            $("#HighSearchForm #Lectcher").val("@SearchParma.Lectcher");
            $("#HighpageFormContent").layoutH();

        });
        function ShowSearchBar(obj) {
            $this = $(obj);
            $target = $($this.attr("target"));
            var isShow = $this.attr("rel") == 0;
            $this.attr("rel", isShow ? 1 : 0);
            if (isShow) {
                $target.show("normal");
                $this.addClass("hide");
            }
            else {
                $target.hide("normal");
                $this.removeClass("hide");
            }
        }

        function ResetForm() {
            $this = $("#HighSearchForm");
            var url = "/CustomerInfo/Default/HighSeach?optype=reset&action=@action";
            $("#SearchFormDIV").loadUrl(url);
            
        }
    </script>
    <form method="post" id="HighSearchForm" action="/CustomerInfo/Default/index?action=@action&OpID=@ViewData["OperateID"]" class="pageForm"
    onsubmit="return @callbackSearch;" id="SearchFormDIV">
    <div class="pageFormContent"  id="HighpageFormContent" layouth="@layouth" style="width:98%">
        <div class="tabs" currentindex="0" eventtype="click">
            <div class="tabsHeader">
                <div class="tabsHeaderContent">
                    <ul>
                        <li><a href="javascript:;"><span>基本信息</span></a></li>
                        <li><a href="javascript:;"><span>归属用户</span></a></li>
                        <li><a href="javascript:;"><span>动态信息</span></a></li>
                        <li><a href="javascript:;"><span>等级信息</span></a></li>
                        <li><a href="javascript:;"><span>群信息</span></a></li>
                    </ul>
                </div>
            </div>
            <div class="tabsContent">
                <div class="container" >
                    @*<div class="title">
                基本信息</div>*@
                    <div class="unit">
                        <label>
                            姓名：</label>
                        @Html.TextBox("Title", SearchParma.Ttile)
                    </div>
                    <div class="unit">
                        <label>
                            性别：</label>
                        @Html.DropDownList("Sex", SexList, HanGu.CRM.HelperCommon.SelectDefaultValue, new { @class = "combox" })
                    </div>
                    <div class="unit">
                        <label>
                            手机：</label>
                        @Html.TextBox("Tel", SearchParma.Tel)
                    </div>
                    <div class="unit">
                        <label>
                            籍贯：</label>
                        @Html.DropDownList("NativePlace", NativePlaceList, HanGu.CRM.HelperCommon.SelectDefaultValue, new { @class = "combox" })
                    </div>
                    <div class="unit">
                        <label>
                            是否有子女：</label>
                        @Html.CheckBox("HasChildren", SearchParma.HasChildren.HasValue && SearchParma.HasChildren.Value)
                    </div>
                    <div class="unit">
                        <label>
                            所在地区：</label>
                        @Html.DropDownList("Provice", ProviceList, HanGu.CRM.HelperCommon.SelectDefaultValue, new { @class = "combox", @ref = "City", @refUrl = "/Area/GetCitys/{value}" })
                     
                        @Html.DropDownList("City", CityList, HanGu.CRM.HelperCommon.SelectDefaultValue, new { @class = "combox" })
                    </div>
                    <div class="unit">
                        <label>
                            所属行业：</label>
                        <table>
                            <tr>
                                @{int j = 1;}
                                @foreach (var item in TradeList)
                                {
                                    <td nowarp="nowarp">
                                        <input name="Trades" class="checkbox" id="Trades" style="magin-left: 5px;" type="checkbox" CHECKED="@TradeSelected.Contains(item.Value)" value="@item.Value"/>
                                        @item.Text
                                        @if (j % 2 == 0)
                                        { 
                                            @MvcHtmlString.Create("</tr><tr>")
                                        }
                                        @{j += 1;
                                        }
                                    </td>
                                }
                            </tr>
                        </table>
                    </div>
                    <div class="divider" />
                    <div class="unit">
                        <label>
                            职位：</label>
                        <table>
                            <tr>
                                @{ j = 1;}
                                @foreach (var item in Position)
                                {
                                    <td nowarp="nowarp">
                                        <input name="Positions" class="checkbox" id="Positions" style="magin-left: 5px;" type="checkbox" CHECKED="@PositionSelected.Contains(item.Value)" value="@item.Value"/>
                                        @item.Text
                                        @if (j % 2 == 0)
                                        { 
                                            @MvcHtmlString.Create("</tr><tr>")
                                        }
                                        @{j += 1;
                                        }
                                    </td>
                                }
                            </tr>
                        </table>
                    </div>
                    <div class="divider" />
                    <div class="unit">
                        <label>
                            职业：</label>
                        <table>
                            <tr>
                                @{ j = 1;}
                                @foreach (var item in JobList)
                                {
                                    <td nowarp="nowarp">
                                        <input name="Jobs" class="checkbox" id="Jobs" style="magin-left: 5px;" type="checkbox" CHECKED="@JobSelected.Contains(item.Value)" value="@item.Value"/>
                                        @item.Text
                                        @if (j % 2 == 0)
                                        { 
                                            @MvcHtmlString.Create("</tr><tr>")
                                        }
                                        @{j += 1;
                                        }
                                    </td>
                                }
                            </tr>
                        </table>
                    </div>
                    <div class="divider">
                    </div>
                    <div class="unit">
                        <label>
                            兴趣点：</label>
                        <table>
                            <tr>
                                @{ j = 1;}
                                @foreach (var item in InterestList)
                                {
                                    <td nowarp="nowarp">
                                        <input name="Interests" class="checkbox" id="Interests" style="magin-left: 5px;" type="checkbox" CHECKED="@InterestArry.Contains(item.Value)" value="@item.Value"/>
                                        @item.Text
                                        @if (j % 2 == 0)
                                        { 
                                            @MvcHtmlString.Create("</tr><tr>")
                                        }
                                        @{j += 1;
                                        }
                                    </td>
                                }
                            </tr>
                        </table>
                    </div>
                </div>
            <div class="container">
                <div class="unit">
                    <label>
                        归属用户：</label>
                    <label style="width: 70%; white-space: nowrap">
                        @foreach (var item in Parents)
                        {
                            <label style="width: auto; white-space: nowrap">
                                <input name="AssignedIns" class="checkbox" id="AssignedIns" style="magin-left: 5px;" type="checkbox" value="@item.Value" />
                                @item.Text
                            </label>
                        }
                    </label>
                </div>
            </div>
            <div class="container">
                @*<div class="title">
                动态信息</div>*@
                <div class="unit">
                    <label>
                        积分：</label>
                    @Html.TextBox("ChargeRandS", SearchParma.ChargeRandS, new { @class = "number" })
                    <label style="width: 20px">
                        至</label>
                    @Html.TextBox("ChargeRandE", SearchParma.ChargeRandE, new { @class = "number" })
                </div>
                <div class="unit">
                    <label>
                        合同总额：</label>
                    @Html.TextBox("ContractRandS", SearchParma.ContractRandS, new { @class = "number" })
                    <label style="width: 20px">
                        至</label>
                    @Html.TextBox("ContractRandE", SearchParma.ContractRandE, new { @class = "number" })
                </div>
                <div class="unit">
                    <label>
                        合同数量：</label>
                    @Html.TextBox("ContractNumRandS", SearchParma.ContractNumRandS, new { @class = "number" })
                    <label style="width: 20px">
                        至</label>
                    @Html.TextBox("ContractNumRandE", SearchParma.ContractNumRandE, new { @class = "number" })
                </div>
            </div>
            <div class="container">
                @*<div class="title">
                等级信息</div>*@
                <div class="unit">
                    <label>
                        重要性：</label>
                    @Html.DropDownList("ImportantLevel", ImportantLevels, HanGu.CRM.HelperCommon.SelectDefaultValue, new { @class = "combox" })
                </div>
                <div class="unit">
                    <label>
                        级别：</label>
                    @Html.DropDownList("Lectcher", MemberGrade, HanGu.CRM.HelperCommon.SelectDefaultValue, new { @class = "combox" })
                </div>
                <div class="unit">
                    <label>
                        学位：</label>
                    @Html.DropDownList("Degree", Degree, HanGu.CRM.HelperCommon.SelectDefaultValue, new { @class = "combox" })
                    <span class="inputInfo"></span>
                </div>
            </div>
            <div class="container">
                @*<div class="title">
                群：</div>*@
                <div class="unit">
                    @foreach (var item in Groups)
                    {

                        <input name="memberGroups" class="checkbox" id="memberGroups" style="magin-left:10px;" type="checkbox" CHECKED="@GroupsSelected.Contains(item.Value)" value="@item.Value"/>
                        @item.Text;

                    }
                </div>
            </div>
        </div>
    </div>
    <div class="unit">
        <label>
            是否显示黑名单：</label>
        @Html.CheckBox("IsBacklist", SearchParma.IsBacklist.HasValue && SearchParma.IsBacklist.Value)
        <span class="inputInfo"></span>
    </div>
    @* @if (isShowPage)
        {
            <div class="unit">
                <label>
                    是否分页：</label>
                @Html.CheckBox("IsPage", SearchParma.IsPage.HasValue && SearchParma.IsPage.Value)
                <span class="inputInfo"></span>
            </div>
        }*@
    @Html.Hidden("IsPage", SearchParma.IsPage)
</div>
<div class="formBar" id="HighSearchBar">
    <ul>
        <li>
            <div class="buttonActive">
                <div class="buttonContent">
                    <button type="submit">
                        开始检索</button></div>
            </div>
        </li>
        <li>
            <div class="button">
                <div class="buttonContent">
                    <button type="reset" onclick="ResetForm()">
                        清空重输</button></div>
            </div>
        </li>
    </ul>
</div>
</form>
@if (!isShowPage)
{
    <div onclick="ShowSearchBar(this)" class="SearchBarControl hide" rel="1" target="#HighSearchForm">
        显示</div>
}
</div> 